import { readonly } from "vue";
import { BasicColumn, FormSchema } from "/@/components/Table"
import DictEnum from "/@/enums/dictEnum";
import { render } from "/@/utils/common/renderUtils";

export const formSchema: FormSchema[] = [
  {
    field: "configKey",
    label: "configKey",
    component: "Input",
    show: false,
  },
  {
    label: "",
    field: "drivider1",
    component: "Input",
    render: () => {
      return render.renderDividerWithValue("密码强度", {
        orientation: 'left',
        style: { marginTop: '-10px', marginLeft: '60px' }
      })
    },
    span: 2,
  },
  {
    field: "passwordLength",
    label: "密码长度限制",
    required: false,
    slot: 'passwordLength',
    colProps: { span: 18 },
    component: "Input"
  },
  {
    field: "minLength",
    label: "最小长度",
    required: true,
    defaultValue: 6,
    show: false,
    component: "Input"
  },
  {
    field: "maxLength",
    label: "最大长度",
    defaultValue: 50,
    show: false,
    required: true,
    component: "Input"
  },
  {
    field: "complexityRules",
    label: "密码复杂度",
    required: true,
    helpMessage: "如果包含任意密码，则将忽略其他规则",
    colProps: { span: 18 },
    component: "CheckboxGroup",
    defaultValue: ['Any'],
    slot: 'complexityRules',
    componentProps: {
      options: [
        { label: "任意密码", value: "Any" },
        { label: "必须包含大写字母", value: "InclusionUpperCase" },
        { label: "必须包含小写字母", value: "InclusionLowerCase" },
        { label: "必须包含数字", value: "InclusionNumber" },
        { label: "必须包含特殊字符 ( @ % + \ / ' ! # $ ^ ? : , ( ) { } [ ] ~ - _ . )", value: "InclusionSpecialCase" },
        { label: "不能包含用户名", value: "ExclusionUsername" },
        { label: "不能包含显示名称或其拼音", value: "ExclusionNickname" },
        { label: "不能包含手机号", value: "ExclusionPhone" },
        { label: "不能包含邮箱", value: "ExclusionEmail" },
      ],
    },
  },
  {
    field: "notSameChars",
    label: "密码相同字符",
    required: true,
    colProps: { span: 12 },
    component: "InputNumber",
    defaultValue: 3,
    helpMessage: '密码不能连续存在相同字符个数'
  },
  {
    field: "historyCheck",
    label: "历史密码检查",
    required: false,
    colProps: { span: 18 },
    component: "Switch",
    defaultValue: false,
    helpMessage: '检查设置的密码是否为历史密码',
    componentProps: {

    },
  },
  {
    field: "weakPasswordCheck",
    label: "弱密码检测",
    required: false,
    colProps: { span: 18 },
    component: "Switch",
    defaultValue: false,
    helpMessage: [
      '弱密码通常是指容易被别人猜测到或被破解工具破解的密码。',
      '在设置或修改密码时，如果密码是弱密码字典中的密码，则系统会强制用户重新设置，以提升用户密码的安全性'
    ]
  },
  {
    field: "validatePassword",
    label: "检测密码",
    colProps: { span: 12 },
    slot: 'validatePassword',
    component: "Input"
  },
  {
    field: "enableLoginCheck",
    label: "登录密码强度检验",
    required: false,
    colProps: { span: 18 },
    component: "Switch",
    defaultValue: true,
    helpMessage: [
      '开启后，用户登录时会对密码强度进行检测，不符合当前密码强度的用户会被引导修改密码后才可以登录',
      '需要同时开启应用登录/注册信息补全功能(需要补全邮箱/手机号)', 
      ' 1、第一次登录会要求补全',
      ' 2、第二次会登录会要求修改密码(后续可能改成不需要第二次登录)'
    ]
  },

  {
    label: "",
    field: "drivider2",
    component: "Input",
    render: () => {
      return render.renderDividerWithValue("密码轮转策略", {
        orientation: 'left',
        style: { marginLeft: '60px' }
      })
    },
    span: 2,
  },
  {
    label: ' ',
    itemProps: {
      colon: false
    },
    colProps: { span: 24 },
    field: "footer-action",
    component: "Input",
    slot: 'footer-action'
  }
]
